package com.chen.tliaswebtest.mapper;

import com.chen.tliaswebtest.pojo.Emp;
import com.chen.tliaswebtest.pojo.JobReport;
import com.chen.tliaswebtest.pojo.User;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * @author chen
 * @version 1.0
 * @create_date 2025/7/24
 * 员工表映射接口
 */
@Mapper
public interface EmpMapper {
    public List<Emp> selectAllByPage(String name, Integer gender, LocalDate begin,
                                     LocalDate end, Integer page, Integer pageSize);

    void deleteEmpByIds(List<Integer> ids);

    void add(Emp emp);

    Emp selectEmpById(Integer id);

    void update(Emp emp);

    List<Emp> selectAll();

    @Select("select count(*) from emp where dept_id = #{deptId}")
    int countByDeptId(Integer deptId);

    @MapKey("name")
    List<Map<String, Integer>> countByGender();

    List<JobReport> countByJob();

    User login(String username, String password);
}
